package com.jm.normal;

import java.util.ArrayList;
import java.util.HashMap;

/**
 * @Description
 * @date 2022/4/21 7:47
 */
public class _834山羊拉丁文 {
    public static void main(String[] args) {
        System.out.println(toGoatLatin("I speak Goat Latin"));
    }

    public static String toGoatLatin(String sentence) {
        ArrayList<Character> c = new ArrayList<>();
        c.add('I');
        c.add('i');
        c.add('E');
        c.add('e');
        c.add('A');
        c.add('a');
        c.add('O');
        c.add('o');
        c.add('U');
        c.add('u');
        StringBuilder sb = new StringBuilder();
        String[] split = sentence.split(" ");
        StringBuilder a = new StringBuilder("a");
        for (String s : split) {
            StringBuilder stringBuilder = new StringBuilder(s);
            // 不包含就将第一位挪到最后
            if (!c.contains(stringBuilder.charAt(0))){
                char firstChar = stringBuilder.charAt(0);
                stringBuilder.deleteCharAt(0);
                stringBuilder.append(firstChar);
            }
            stringBuilder.append("ma").append(a).append(" ");
            a.append("a");
            sb.append(stringBuilder);
        }
        sb.deleteCharAt(sb.length() - 1);
        return sb.toString();
    }
}
